using System.Collections.Generic;
using System.IO;

namespace Pronghorn.Core
{
	public class SkinNodeParser : ISkinNodeParser
	{
		#region Fields

		private string _line;
		private readonly IList<INodeVisitor> _visitors;

		#endregion Fields

		#region Constructors

		public SkinNodeParser(string line, IList<INodeVisitor> visitors)
		{
			Line = line;
			_visitors = visitors;
		}

		#endregion Constructors

		#region Public Properties

		public string Line
		{
			get { return _line; }
			set { _line = value; }
		}

		#endregion Public Properties

		#region Public Methods

		public void Parse(TextWriter writer)
		{
			foreach (var nodeVisitor in _visitors)
			{
			    nodeVisitor.Visit(this);
			}
			writer.Write(_line);
		}

		#endregion Public Methods
	}
}